﻿using System;

namespace enyo
{
    /// <summary>
    /// Manages a long list by rendering only small portions of the list at a time. Uses flyweight strategy via onSetupRow.
    /// We suggest users stick to the derived kind VirtualList instead.
    /// VirtualList introduces a paging strategy for backing data, but it can be ignored if it's not needed.
    /// </summary>
    public class ScrollingList : VFlexBox
    {
        /// <summary>
        /// sent with arguments (inSender,inIndex) to ask owner to prepare the row with specificed index by setting the properties of the objects in the list's components. 
        /// Return true if you should keep getting more onSetupRow events for more items.
        /// </summary>
        //TODO:Return????? true/false
        public EnyoCallback<bool, Control, int> onSetupRow;


        /// <summary>
        /// return the index of the active row
        /// </summary>
        /// <returns></returns>
        public int FetchRowIndex()
        {
            return 0;
        }

        /// <summary>
        /// move the active index of the list to inIndex where it can be altered
        /// </summary>
        /// <param name="index"></param>
        public void PrepareRow(int index)
        {
        }

        /// <summary>
        /// completely reset the list so that it reloads all data and rerenders
        /// </summary>
        public void Punt()
        {
        }

        /// <summary>
        /// redraw any visible items in the list to reflect data changes without adjusting the list positition
        /// </summary>
        public void Refresh()
        {
        }

        /// <summary>
        /// clear the list's internal state and refresh
        /// </summary>
        public void Reset()
        {
        }

        /// <summary>
        /// adjust rendering buffers to fit display
        /// </summary>
        public void Update()
        {
        }

        /// <summary>
        /// indicate that a row has changed so the onSetupRow callback will be called for it
        /// </summary>
        /// <param name="index"></param>
        public void UpdateRow(int index)
        {
        }
    }
}
